layui.use(['form','jquery','layer',"laydate"],function(){
    var form = layui.form,
        $    = layui.jquery,
        layer = layui.layer,   //默认启用用户
     laydate = layui.laydate;

    form.on("submit(addUser)",function(data){
        var loadIndex = layer.load(2, {
            shade: [0.3, '#333']
        });
        console.log( JSON.stringify(data.field))
      /*  var hoptions={
            setupTime:data.field.setupTime,
            robsTime:data.field.robsTime,
            bettonTime:data.field.bettonTime,
            brightBrandTime:data.field.brightBrandTime
        };*/
        var data1 ={
            postions : data.field.postions,
            gameType : data.field.gameType,
            pumping : data.field.pumping,
            roomGrade : data.field.roomGrade
            //hoptions : JSON.stringify(hoptions)
        };
        $.ajax({
            type:"POST",
            url:baseUrl+'room/add',
            contentType:"application/json",
            async : false,
            data:JSON.stringify(data1),
            success:function(res){
                layer.close(loadIndex);
                if(res.meta.code ===200){
                    parent.layer.msg("房间添加成功!",{time:1500},function(){
                        //刷新父页面
                        parent.location.reload();
                    });
                }else{
                    layer.msg(res.message);
                }
            }
        });
        return false;
    });

});